package com.nf.health.app.mine.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.nf.health.app.R;
import com.nf.health.app.activity.global.BaseActivity;
import com.nf.health.app.utils.ActivityUtils;
import com.nf.health.app.utils.Util;
import com.nf.health.app.utils.ViewUtil;

import butterknife.Bind;
import butterknife.ButterKnife;
/**
 * @author Ian
 * @version V1.3
 * @Description: My setting  About  Activity
 * @date 2015-10-21 下午1:23:12
 */
public class   AboutUsActivity extends BaseActivity implements OnClickListener {
    @Bind(R.id.tv_versions)
    TextView tvVersions;
    @Bind(R.id.ll_known)
    RelativeLayout llKnown;
    @Bind(R.id.comment_name)
    TextView commentName;
    @Bind(R.id.iv_back)
    ImageView ivBack;
    @Bind(R.id.ll_comment)
    RelativeLayout llComment;
    private RelativeLayout ll_privacy, ll_function, ll_known, ll_comment;
    private TextView versions_num;

    protected void onCreate(Bundle  savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitleBar(R.layout.titlebar_base);
        setContent(R.layout.activity_my_app_details);
        ButterKnife.bind(this);
        ViewUtil.setText(this, R.id.titlebar_title_tv, "关于我们");
        versions_num = (TextView) findViewById(R.id.versions_num);
        ll_privacy = (RelativeLayout) findViewById(R.id.ll_privacy);
        ll_function = (RelativeLayout) findViewById(R.id.ll_function);
        ll_known = (RelativeLayout) findViewById(R.id.ll_known);
        ll_comment = (RelativeLayout) findViewById(R.id.ll_comment);
        initListener();
        tvVersions.setText("爱尚康     for Android"+"  v"+ Util.getVersionName(this));
    }
    private void initListener() {
        ll_privacy.setOnClickListener(this);
        ll_function.setOnClickListener(this);
        ll_known.setOnClickListener(this);
         ll_comment.setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ll_privacy:
                Bundle bundlePrivacy = new Bundle();
                bundlePrivacy.putString("type","privacy");
                ActivityUtils.showActivity(this, IntroductionActivity.class, bundlePrivacy);
                break;
            case R.id.ll_function:
                Bundle bundleFunction = new Bundle();
                bundleFunction.putString("type", "function");
                ActivityUtils.showActivity(this, IntroductionActivity.class, bundleFunction);
                break;
            case R.id.ll_known:
                Bundle bundleKnown = new Bundle();
                bundleKnown.putString("type", "known");
                ActivityUtils.showActivity(this, IntroductionActivity.class, bundleKnown);
                break;
            case R.id.ll_comment:
                try {
                    Uri uri = Uri.parse("market://details?id=" + getPackageName());
                    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(intent);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                break;
        }
        super.onClick(v);
    }
}
